// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import 'babel-polyfill'
import Vue from 'vue'
import App from './App'
import VueRouter from 'vue-router'
import VueResource from 'vue-resource'
import VueWechatTitle from 'vue-wechat-title'
import { Upload, Button } from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import wx from 'weixin-js-sdk'

// 蒙牛活动
import clubdetail from './components/clubdetail/clubdetail'
import fillinfo from './components/fillinfo/fillinfo'
// merry xmas
import xmasClubdetail from './components/xmas_clubdetail/clubdetail'
// 瑜伽馆主评选
import auth from './components/shopkeeper/auth'
import keeperApply from './components/shopkeeper/apply'
import keeperRank from './components/shopkeeper/rank'
import keeperRule from './components/shopkeeper/rule'
import keeperDetail from './components/shopkeeper/detail'

import './common/stylus/index.styl'
Vue.config.debug = true
Vue.config.productionTip = false
Vue.use(VueRouter)
Vue.use(VueResource)
Vue.use(VueWechatTitle)
Vue.use(Upload)
Vue.use(Button)
Vue.use(wx)
// 蒙牛活动、 merry xmas
const routes = [
  {path: '/', name: 'index', meta: {title: '恭喜您 获得瑜伽周卡'}},
  {path: '/clubdetail/:id', name: 'clubdetail', component: clubdetail, meta: {title: '场馆详情'}},
  {path: '/fillinfo', name: 'fillinfo', component: fillinfo, meta: {title: '信息填写'}},
  {path: '/xmas', name: 'xmasIndex', meta: {title: '岁末感恩活动'}},
  {path: '/xmas/debug', name: 'debug', meta: {title: 'debug'}},
  {path: '/xmasClubdetail/:id', name: 'xmasClubdetail', component: xmasClubdetail, meta: {title: '场馆详情'}},
  {path: '/shopkeeper', name: 'shopkeeper', meta: {title: '寻找中国最美馆主'}},
  {path: '/shopkeeper/auth', name: 'auth', component: auth, meta: {title: '寻找中国最美馆主'}},
  {path: '/shopkeeper/apply', name: 'keeperApply', component: keeperApply, meta: {title: '寻找中国最美馆主'}},
  {path: '/shopkeeper/rank', name: 'keeperRank', component: keeperRank, meta: {title: '寻找中国最美馆主'}},
  {path: '/shopkeeper/rule', name: 'keeperRule', component: keeperRule, meta: {title: '寻找中国最美馆主'}},
  {path: '/shopkeeper/detail', name: 'keeperDetail', component: keeperDetail, meta: {title: '寻找中国最美馆主'}}
]

const router = new VueRouter({
  routes,
  linkActiveClass: 'active'
})

/* eslint-disable no-new */
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')

// Vue.prototype.wxShare = function () {
//   this.$http.get(`/weixin/sign?url='https://xcx2018.50yoga.cn/api/shield/vote/index'&apis=onMenuShareTimeline,onMenuShareAppMessage`, {
//     headers: { Accept: 'application/vnd.sci.v2+json' }
//   }).then((res) => {
//     wx.config({
//       debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
//       appId: res.data.appid, // 必填，公众号的唯一标识
//       timestamp: res.data.timestamp, // 必填，生成签名的时间戳
//       nonceStr: res.data.noncestr, // 必填，生成签名的随机串
//       signature: res.data.signature, // 必填，签名，见附录1
//       jsApiList: res.data.jsApiList // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
//     })
//   })
//   wx.ready(function () {
//     wx.onMenuShareAppMessage({
//       title: '寻找中国最美馆主',
//       desc: '寻找中国最美馆主',
//       link: 'https://xcx2018.50yoga.cn/api/shield/vote/index',
//       imgUrl: 'http://piccdn.50yoga.cn/pics/public/sweet/images/share-title/.png',
//       success: function () {
//         console.log('分享成功')
//       }
//     })
//   })
// }
